// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asSoundListenerComponent.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the SoundListenerComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asSoundListenerComponent.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__
#ifdef __COMPILE_WITH_SFML_AUDIO__

#include "../../ScriptHelper.h"
#include "../../core/asEntityComponent.h"

#include "../../../components/sound/SoundListenerComponent.h"


//! Reference factory for the SoundListenerComponent class.
SoundListenerComponent* createSoundListenerComponent(Entity *parent, bool isMainListener = true)
{
    return new SoundListenerComponent(parent, isMainListener);
}

//! Binds the SoundListenerComponent class to AngelScript.
void bindSoundListenerComponent(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind SoundListenerComponent class.
    r = engine->RegisterObjectType("SoundListenerComponent", sizeof(SoundListenerComponent), asOBJ_REF); assert(r >= 0);

    // Bind inherited functions.
    bindEntityComponentBase<SoundListenerComponent>(engine, "SoundListenerComponent");

    // Set SoundListenerComponent behaviour.
    r = engine->RegisterObjectBehaviour("SoundListenerComponent", asBEHAVE_FACTORY, "SoundListenerComponent@ f(Entity @+)",
                                        asFUNCTION(createSoundListenerComponent), asCALL_CDECL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("SoundListenerComponent", asBEHAVE_FACTORY, "SoundListenerComponent@ f(Entity @+, bool)",
                                        asFUNCTION(createSoundListenerComponent), asCALL_CDECL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SoundListenerComponent", "SoundListenerComponent& opAssign(const SoundListenerComponent &in)",
                                     asFUNCTION(assignT<SoundListenerComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);

    // Bind SoundListenerComponent class functions.
    r = engine->RegisterObjectMethod("SoundListenerComponent", "bool getIsMainListener()",
                                     asMETHOD(SoundListenerComponent, getIsMainListener), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SoundListenerComponent", "void setIsMainListener()",
                                     asMETHOD(SoundListenerComponent, setIsMainListener), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("SoundListenerComponent", "void setIsMainListener(bool)",
                                     asMETHOD(SoundListenerComponent, setIsMainListener), asCALL_THISCALL); assert(r >= 0);
}

#endif // __COMPILE_WITH_SFML_AUDIO__
#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
